//
//  NavigationSubDemo.m
//  Exercise
//
//  Created by zhouxiaobo on 15/11/13.
//  Copyright © 2015年 mapath. All rights reserved.
//

#import "NavigationSubDemo.h"
#import "NavigationSub2Demo.h"

@implementation NavigationSubDemo

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor purpleColor];
    self.title = @"导航一";
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(screenWidth/2 - 40, 120, 80, 30);
    btn.backgroundColor = [UIColor redColor];
    [btn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    [btn setTitle:@"Pop" forState:UIControlStateNormal];
    [btn setTitle:@"Pop" forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.frame = CGRectMake(screenWidth/2 - 40, 180, 80, 30);
    btn1.backgroundColor = [UIColor redColor];
    [btn1 setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    [btn1 setTitle:@"Push" forState:UIControlStateNormal];
    [btn1 setTitle:@"Push" forState:UIControlStateHighlighted];
    [btn1 addTarget:self action:@selector(goNext) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];

    
    //显示toolbar
    self.navigationController.toolbarHidden = NO;
}

- (void)goBack {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)goNext {
    NavigationSub2Demo *navigationSub2Demo = [[NavigationSub2Demo alloc]init];
    navigationSub2Demo.titleNumber++;
    [self.navigationController pushViewController:navigationSub2Demo animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
